package com.hong.cloud.mall.practice.cartorder.mq;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 描述：RabbitMQ配置类
 */

@Configuration
public class MQConfig {
    @Bean
    public Queue queue() {
        return new Queue("queue1", true);
    }

    @Bean
    DirectExchange exchange() {
        return new DirectExchange("cloud-mall-exchange");
    }

    @Bean
    Binding bindingExchangeMessage(Queue queue, DirectExchange exchange) {
        return BindingBuilder.bind(queue).to(exchange).with("productStock");
    }
}
